const {
  req
} = require('../../utils/requests')
Page({


  data: {
    // 轮播图数据
    bannerList: [],
    time: '',
    value: '',
    // 动态详情
    webList: []
  },

  onLoad() {
    this.init()
    this.getNowTime()
  },
  init() {
    let self = this
    wx.request({
      url: 'https://r.inews.qq.com/web_feed/getWebList',
      method: 'POST',
      data: {
        "adcode": "110000",
        "device_id": "0_b7ea3f1792cda",
        "channel_id": "news_news_nba",
        "uin": "test",
        "qimei36": "0_b7ea3f1792cda",
        "base_req": {
          "from": "qq_web"
        },
        "forward": "2",
        "is_local_chlid": "",
        "flush_num": 1
      },
      header: {
        'content-type': 'application/json' // 默认值
      },
      success(res) {
        self.setData({
          bannerList: res.data.data.slice(0, 6),
          webList: res.data.data
        })
      }
    })

  },
  onGoToDetail() {
    wx.navigateTo({
      url: '/pages/detail/detail',
    })
  },

  getNowTime() {
    let t = new Date()
    let y = t.getFullYear()
    let m = t.getMonth() + 1
    let d = t.getDate()
    let hh = t.getHours()
    let mm = t.getMinutes()
    let ss = t.getSeconds()
    this.setData({
      time: `${y}-${m}-${d}  ${hh}:${mm}:${ss}`
    })
  },

})